Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial setup for migrating to declarative mapping #12042

Merged
merged 1 commit into from
May 25, 2021

Conversation

jdavcs
Copy link
Member

@jdavcs jdavcs commented May 24, 2021

What did you do?

This removes a deprecated SQLAlchemy function and sets up the necessary infrastructure to incrementally migrate Galaxy to declarative mapping.

  1. Create a sqlalchemy.orm.registry object
  2. Use the registry's metadata for both model/__init__.py and mapping.py

Why:

  1. Direct usage of mapper() function is deprecated
  2. Mapper assumes a registry object is present
  3. Both declarative and imperative (aka classical) mapping use a
    registry object in the background. Access to this object is also
    necessary to incrementally migrate Galaxy to declarative mapping (as
    opposed to moving the entire model and eliminating mapping.py in one
    step).

https://docs.sqlalchemy.org/en/14/orm/mapping_styles.html#imperative-a-k-a-classical-mappings

Why did you make this change?

See #10901

How to test the changes?

This is a refactoring of components with existing test coverage.

License

  • I agree to license these contributions under Galaxy's current license.
  • I agree to allow the Galaxy committers to license these and all my past contributions to the core galaxy codebase under the MIT license. If this condition is an issue, uncheck and just let us know why with an e-mail to [email protected].

1. Create sqlalchemy.orm.registry
2. Use registry.metadata for both model/__init__ and mapping.py

Why:
1) Direct usage of mapper() function is deprecated
2) Mapper assumes a registry object is present
3) Both declarative and imperative (aka classical) mapping use a
registry object in the background. Access to this object is also
necessary to INCREMENTALLY migrate Galaxy to declarative mapping (as
opposed to moving the entire model and eliminating mapping.py in one
step).

https://docs.sqlalchemy.org/en/14/orm/mapping_styles.html#imperative-a-k-a-classical-mappings
@jdavcs jdavcs added kind/enhancement area/database Galaxy's database or data access layer labels May 24, 2021
@jdavcs jdavcs added this to the 21.09 milestone May 24, 2021
@jdavcs jdavcs merged commit b83e480 into galaxyproject:dev May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Galaxy's database or data access layer kind/enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants